<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改申请记录')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-society-submit" th:object="${recordSociety}">
            <h4 class="form-header h4">申请记录信息</h4>
            <input name="societyId" th:field="*{societyId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">人员类型：</label>
                <div class="form-control-static" th:if="*{userType == '01'}">
                    普通职工
                </div>
                <div class="form-control-static" th:if="*{userType == '02'}">
                    中层及以上
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">专业：</label>
                <div class="form-control-static" th:text="*{major}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">参加学会、协会名称：</label>
                <div class="form-control-static" th:text="*{societyTitle}">
                </div>
            </div>
            <div class="form-group select-time">
                <label class="col-sm-3 control-label is-required">开始时间：</label>
                <div class="form-control-static" th:text="*{startTime}">
                </div>
            </div>
            <div class="form-group select-time">
                <label class="col-sm-3 control-label is-required">结束时间：</label>
                <div class="form-control-static" th:text="*{endTime}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="form-control-static" th:text="*{remark}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">科教科：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="scienceId" name="scienceId" type="hidden" th:field="*{scienceId}" />
                        <input class="form-control" type="text" onclick="selectUserTree('science')" id="scienceName" name="scienceName" th:field="*{scienceName}" readonly="true">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">分管领导：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="scienceLeaderId" name="scienceLeaderId" type="hidden" th:field="*{scienceLeaderId}" />
                        <input class="form-control" type="text" onclick="selectUserTree('scienceLeader')" id="scienceLeaderName" name="scienceLeaderName" th:field="*{scienceLeaderName}" readonly="true">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">已参加学会、协会</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table"></table>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "record/society";
        $("#form-society-submit").validate({
            focusCleanup: true
        });

        var verifyType = '';
        /* 选择人员 */
        function selectUserTree(type) {
            verifyType = type;
            var options = {
                title: '选择员工',
                width: "380",
                url: ctx + "basic/user/selectTree",
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var tree = layero.find("iframe")[0].contentWindow.$._tree;
            var body = layer.getChildFrame('body', index);
            var verifyId = "#" + verifyType + "Id";
            var verifyName = "#" + verifyType + "Name";
            var id = body.find('#treeId').val();
            var treeId = id.substring(id.indexOf('_') + 1, id.length);
            var name = body.find('#treeName').val();
            var treeName = name.substring(0, name.indexOf('('));
            $(verifyId).val(treeId);
            $(verifyName).val(treeName);
            layer.close(index);
        }

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/submit", $('#form-society-submit').serialize());
            }
        }

        $(function() {
            var options = {
                data: [[${recordSociety.recordSocietyContentList}]],
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [
                {
                    field: 'societyTitle',
                    align: 'center',
                    title: '已参加学会、协会名称'
				},
                {
                    field: 'startTime',
                    align: 'center',
                    title: '开始时间'
				},
                {
                    field: 'endTime',
                    align: 'center',
                    title: '结束时间'
				}]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>